Page({
  data: {
    toggleAnimationData: {}, // 列表动画
    isShow: [{
      inShow: true
      },
      {
        inShow: false
      }
    ],
    listArr: [{
        id: 1,
        isShow: false,
        name: 'QQ',
        list: [{
            name: 'QQ头像获取'
          },
          {
            name: 'QQ匿名头像获取'
          },
          {
            name: 'QQ空间昵称/头像获取'
          },
          {
            name: 'QQ发起强制对话'
          },
          {
            name: 'QQ免key加群'
          },
          {
            name: 'QQ在线状态查询'
          },
          {
            name: 'QQ空间头像获取'
          },
          {
            name: 'QQ资料卡唤醒'
          },
          {
            name: 'QQ群头像获取'
          },
        ],
      },
      {
        id: 2,
        isShow: false,
        name: '微博',
        list: [{
            name: '微博用户信息获取'
          },
          {
            name: '微博视频无水印解析'
          },
          {
            name: '绿洲无水印解析'
          }
        ]
      }
    ]
  },
  show: function () {

  },
  changeToggle(e) {
    let that = this
    let indexs = e.currentTarget.dataset.index
    let list  = this.data.listArr
    let Show = this.data.isShow
    let animation = wx.createAnimation({
      duration: 300,
      timingFunction: 'ease-out'
    });
    Show[indexs].inShow=!Show[indexs].inShow || false
    if(!Show[indexs].inShow){
      animation.height('100rpx').step();
    }else{
      // 动态计算高度值 = 每个盒子高度*总数
        let height = this.data.listArr[indexs].list.length *30 +'rpx'
        animation.height(height).step();
      
    }
    that.setData({
      isShow:Show,
      toggleAnimationData: animation.export()
    })
  }
})